import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import unoCss from 'unoCss/vite'
import { presetIcons,presetAttributify,presetUno } from 'unocss'
import unocss from 'unocss/postcss'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), unoCss({
  presets: [ presetIcons(),presetAttributify(),presetUno() ],
    rules: [
      [
        'flex',
        {
          display: 'flex'
        } 
      ],
      [
        'red',
        {
          color:'red'
        } 
      ],
      [/^m-(\d+)$/, ([, d]) => ({ margin: `${Number(d) * 10}px` })],
    ],
    shortcuts:{
      cike:['flex','red']
    }
    })],

  server: {
    // 解决的是dev环境下的跨域问题
    proxy: {
      '/api': {
        target: 'http://localhost:3000',
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  }
})



